<!DOCTYPE HTML>
<html lang="zh-hans" >
    <!-- Start book Python基础 -->
<!-- Start book Python基础 -->
    <head>
        <!-- head:start -->
<!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>标识符和关键字 | Python基础</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="姜伟">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-prism/prism.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="chapter11.html" />
    
    
    <link rel="prev" href="chapter09.html" />
    

        <!-- head:end -->
<!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
<!-- body:start -->
        
    <div class="book"
        data-level="10"
        data-chapter-title="标识符和关键字"
        data-filepath="chapter10.md"
        data-basepath="."
        data-revision="Mon Feb 03 2020 11:09:50 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="index.html">
                
                        <i class="fa fa-check"></i>
                        
                        学习目标
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="chapter01.html">
            
                
                    <a href="chapter01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        计算机组成
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="chapter02.html">
            
                
                    <a href="chapter02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        什么是编程语言
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3" data-path="chapter03.html">
            
                
                    <a href="chapter03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        Python语言介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="chapter04.html">
            
                
                    <a href="chapter04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        安装配置Python
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="chapter05.html">
            
                
                    <a href="chapter05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        开发工具介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="chapter06.html">
            
                
                    <a href="chapter06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        Pycharm的基本使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="chapter07.html">
            
                
                    <a href="chapter07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        交互式编程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="chapter08.html">
            
                
                    <a href="chapter08.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        注释的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9" data-path="chapter09.html">
            
                
                    <a href="chapter09.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        变量及数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="10" data-path="chapter10.html">
            
                
                    <a href="./chapter10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        标识符和关键字
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11" data-path="chapter11.html">
            
                
                    <a href="chapter11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        输出语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12" data-path="chapter12.html">
            
                
                    <a href="chapter12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        输入语句
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本书使用 GitBook 发布
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="" >Python基础</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x6807;&#x8BC6;&#x7B26;&#x548C;&#x5173;&#x952E;&#x5B57;">&#x6807;&#x8BC6;&#x7B26;&#x548C;&#x5173;&#x952E;&#x5B57;</h1>
<h2 id="&#x6807;&#x8BC6;&#x7B26;">&#x6807;&#x8BC6;&#x7B26;</h2>
<p><img src="imgs/&#x6807;&#x8BC6;&#x7B26;.jpg" alt=""></p>
<p>&#x8BA1;&#x7B97;&#x673A;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x4E2D;&#xFF0C;&#x6807;&#x8BC6;&#x7B26;&#x662F;&#x7528;&#x6237;&#x7F16;&#x7A0B;&#x65F6;&#x4F7F;&#x7528;&#x7684;&#x540D;&#x5B57;&#xFF0C;&#x7528;&#x4E8E;&#x7ED9;&#x53D8;&#x91CF;&#x3001;&#x5E38;&#x91CF;&#x3001;&#x51FD;&#x6570;&#x3001;&#x8BED;&#x53E5;&#x5757;&#x7B49;&#x547D;&#x540D;&#xFF0C;&#x4EE5;&#x5EFA;&#x7ACB;&#x8D77;&#x540D;&#x79F0;&#x4E0E;&#x4F7F;&#x7528;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#x3002;</p>
<h2 id="&#x547D;&#x540D;&#x89C4;&#x5219;">&#x547D;&#x540D;&#x89C4;&#x5219;</h2>
<ol>
<li>&#x6807;&#x8BC6;&#x7B26;&#x7531;&#x5B57;&#x6BCD;&#x3001;&#x4E0B;&#x5212;&#x7EBF;&#x548C;&#x6570;&#x5B57;&#x7EC4;&#x6210;&#xFF0C;&#x4E14;&#x6570;&#x5B57;&#x4E0D;&#x80FD;&#x5F00;&#x5934;&#x3002;</li>
<li>&#x4E25;&#x683C;&#x533A;&#x5206;&#x5927;&#x5C0F;&#x5199;&#x3002;</li>
<li>&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x5173;&#x952E;&#x5B57;&#x3002;</li>
</ol>
<blockquote>
<p>&#x601D;&#x8003;&#xFF1A;&#x4E0B;&#x9762;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x54EA;&#x4E9B;&#x662F;&#x6B63;&#x786E;&#x7684;&#xFF0C;&#x54EA;&#x4E9B;&#x4E0D;&#x6B63;&#x786E;&#x4E3A;&#x4EC0;&#x4E48;</p>
</blockquote>
<pre><code>   fromNo12
   from#12
   my_Boolean
   my-Boolean
   Obj2
   2ndObj
   myInt
   test1
   Mike2jack
   My_tExt
   _test
   test!32
   haha(da)tt
   int
   jack_rose
   jack&amp;rose
   GUI
   G.U.I
</code></pre><h2 id="&#x547D;&#x540D;&#x89C4;&#x8303;">&#x547D;&#x540D;&#x89C4;&#x8303;</h2>
<ul>
<li>&#x6807;&#x8BC6;&#x7B26;&#x547D;&#x540D;&#x8981;&#x505A;&#x5230;&#x987E;&#x540D;&#x601D;&#x4E49;&#x3002;</li>
</ul>
<blockquote>
<p>&#x8D77;&#x4E00;&#x4E2A;&#x6709;&#x610F;&#x4E49;&#x7684;&#x540D;&#x5B57;&#xFF0C;&#x5C3D;&#x91CF;&#x505A;&#x5230;&#x770B;&#x4E00;&#x773C;&#x5C31;&#x77E5;&#x9053;&#x662F;&#x4EC0;&#x4E48;&#x610F;&#x601D;(&#x63D0;&#x9AD8;&#x4EE3;&#x7801;&#x53EF; &#x8BFB;&#x6027;) &#x6BD4;&#x5982;: &#x540D;&#x5B57; &#x5C31;&#x5B9A;&#x4E49;&#x4E3A; name , &#x5B9A;&#x4E49;&#x5B66;&#x751F; &#x7528; student</p>
</blockquote>
<pre><code class="lang-python">a = <span class="hljs-string">&quot;zhangsan&quot;</span>  <span class="hljs-comment"># bad</span>
name = <span class="hljs-string">&quot;zhangsan&quot;</span>  <span class="hljs-comment"># good</span>
b = <span class="hljs-number">23</span>   <span class="hljs-comment"># bad</span>
age = <span class="hljs-number">23</span> <span class="hljs-comment"># good</span>
</code></pre>
<ul>
<li><p>&#x9075;&#x5B88;&#x4E00;&#x5B9A;&#x7684;&#x547D;&#x540D;&#x89C4;&#x8303;&#x3002;</p>
<ul>
<li>&#x9A7C;&#x5CF0;&#x547D;&#x540D;&#x6CD5;&#xFF0C;&#x53C8;&#x5206;&#x4E3A;&#x5927;&#x9A7C;&#x5CF0;&#x547D;&#x540D;&#x6CD5;&#x548C;&#x5C0F;&#x9A7C;&#x5CF0;&#x547D;&#x540D;&#x6CD5;&#x3002;
<img src="imgs/&#x9A7C;&#x5CF0;&#x547D;&#x540D;&#x6CD5;.jpg" alt=""><ul>
<li>&#x5C0F;&#x9A7C;&#x5CF0;&#x5F0F;&#x547D;&#x540D;&#x6CD5;&#xFF08;lower camel case&#xFF09;&#xFF1A; &#x7B2C;&#x4E00;&#x4E2A;&#x5355;&#x8BCD;&#x4EE5;&#x5C0F;&#x5199;&#x5B57;&#x6BCD;&#x5F00;&#x59CB;&#xFF1B;&#x7B2C;&#x4E8C;&#x4E2A;&#x5355;&#x8BCD;&#x7684;&#x9996;&#x5B57;&#x6BCD;&#x5927;&#x5199;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;myName&#x3001;aDog</li>
<li>&#x5927;&#x9A7C;&#x5CF0;&#x5F0F;&#x547D;&#x540D;&#x6CD5;&#xFF08;upper camel case&#xFF09;&#xFF1A; &#x6BCF;&#x4E00;&#x4E2A;&#x5355;&#x5B57;&#x7684;&#x9996;&#x5B57;&#x6BCD;&#x90FD;&#x91C7;&#x7528;&#x5927;&#x5199;&#x5B57;&#x6BCD;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;FirstName&#x3001;LastName.</li>
</ul>
</li>
<li>&#x8FD8;&#x6709;&#x4E00;&#x79CD;&#x547D;&#x540D;&#x6CD5;&#x662F;&#x7528;&#x4E0B;&#x5212;&#x7EBF;&#x201C;_&#x201D;&#x6765;&#x8FDE;&#x63A5;&#x6240;&#x6709;&#x7684;&#x5355;&#x8BCD;&#xFF0C;&#x6BD4;&#x5982;send_buf.
Python&#x7684;&#x547D;&#x4EE4;&#x89C4;&#x5219;&#x9075;&#x5FAA;PEP8&#x6807;&#x51C6;&#xFF1A;</li>
</ul>
<blockquote>
<p>&#x53D8;&#x91CF;&#x540D;&#xFF0C;&#x51FD;&#x6570;&#x540D;&#x548C;&#x6587;&#x4EF6;&#x540D;&#x5168;&#x5C0F;&#x5199;&#xFF0C;&#x4F7F;&#x7528;&#x4E0B;&#x5212;&#x7EBF;&#x8FDE;&#x63A5;&#xFF1B;
&#x7C7B;&#x540D;&#x9075;&#x5B88;&#x5927;&#x9A7C;&#x5CF0;&#x547D;&#x540D;&#x6CD5;&#xFF1B;
&#x5E38;&#x91CF;&#x540D;&#x5168;&#x5927;&#x5199;&#xFF1B;</p>
</blockquote>
</li>
</ul>
<h2 id="&#x5173;&#x952E;&#x5B57;">&#x5173;&#x952E;&#x5B57;</h2>
<ul>
<li>&#x5173;&#x952E;&#x5B57;&#x7684;&#x6982;&#x5FF5;
&#x4E00;&#x4E9B;&#x5177;&#x6709;&#x7279;&#x6B8A;&#x529F;&#x80FD;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#xFF0C;&#x8FD9;&#x5C31;&#x662F;&#x6240;&#x8C13;&#x7684;&#x5173;&#x952E;&#x5B57;&#x3002;
&#x5173;&#x952E;&#x5B57;&#xFF0C;&#x5DF2;&#x7ECF;&#x88AB;python&#x5B98;&#x65B9;&#x4F7F;&#x7528;&#x4E86;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x5141;&#x8BB8;&#x5F00;&#x53D1;&#x8005;&#x81EA;&#x5DF1;&#x5B9A;&#x4E49;&#x548C;&#x5173;&#x952E;&#x5B57;&#x76F8;&#x540C;&#x540D;&#x5B57;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x3002;</li>
<li>&#x5173;&#x952E;&#x5B57;</li>
</ul>
<pre><code class="lang-python">False     None    True   and      as       assert   break     class  
continue  def     del    elif     else     except   finally   for
from      global  if     import   in       is       lambda    nonlocal
not       or      pass   raise    return   try      while     with  
yield
</code></pre>
<p>&#x5173;&#x952E;&#x5B57;&#x7684;&#x5B66;&#x4E60;&#x4EE5;&#x53CA;&#x4F7F;&#x7528;&#xFF0C;&#x54B1;&#x4EEC;&#x4F1A;&#x5728;&#x540E;&#x9762;&#x7684;&#x8BFE;&#x7A0B;&#x4E2D;&#x4F9D;&#x6B21;&#x4E00;&#x4E00;&#x8FDB;&#x884C;&#x5B66;&#x4E60;&#x3002;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="chapter09.html" class="navigation navigation-prev " aria-label="Previous page: 变量及数据类型"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="chapter11.html" class="navigation navigation-next " aria-label="Next page: 输出语句"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-copy-code-button/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{},"splitter":{},"copy-code-button":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
<!-- body:end -->
    </body>
    <!-- End of book Python基础 -->
<!-- End of book Python基础 -->
</html>
